package primary;

public class RemoveDuplicates {
	public static void main(String[] args) {
		int nums[] = {0,1,1,2,2,3,3,4};		
		int len =  removeDuplicates(nums);
		for (int i = 0; i < len; i++) {
			System.out.println(len);
		}
	}
	public static int removeDuplicates(int[] nums) {
	       int len = 0;
	       for (int i = 0; i < nums.length; i++) {
				if (nums[i] != nums[len]) {
					len++;
					nums[len] = nums[i];
				}
				len +=1;
		}       
	        return len;
	    }
}

